import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import React from 'react';
import { List } from 'antd';
import classNames from 'classnames';
import styles from "./NoticeList.less?modules";
export default function NoticeList(_ref) {
  var _ref$data = _ref.data,
      data = _ref$data === void 0 ? [] : _ref$data,
      _onClick = _ref.onClick,
      locale = _ref.locale,
      emptyText = _ref.emptyText,
      emptyImage = _ref.emptyImage,
      contentTitle = _ref.contentTitle,
      contentTitleAction = _ref.contentTitleAction;
  var content;

  if (data.length === 0) {
    content = /*#__PURE__*/React.createElement("div", {
      className: styles.notFound
    }, emptyImage ? /*#__PURE__*/React.createElement("img", {
      src: emptyImage,
      alt: "not found"
    }) : null, /*#__PURE__*/React.createElement("div", null, emptyText || locale.emptyText));
  } else {
    content = /*#__PURE__*/React.createElement(List, {
      className: styles.list
    }, data.map(function (item, i) {
      var itemCls = classNames(styles.item, _defineProperty({}, styles.read, item.read));
      return /*#__PURE__*/React.createElement(List.Item, {
        className: itemCls,
        key: item.key || i,
        onClick: function onClick() {
          return _onClick(item);
        }
      }, /*#__PURE__*/React.createElement(List.Item.Meta, {
        className: styles.meta // avatar={item.avatar ? <Avatar className={styles.avatar} src={item.avatar} /> : null}
        ,
        title: /*#__PURE__*/React.createElement("div", {
          className: styles.title
        }, item.title, /*#__PURE__*/React.createElement("div", {
          className: styles.extra
        }, item.extra)),
        description: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
          className: styles.description,
          title: item.description
        }, item.description), /*#__PURE__*/React.createElement("div", {
          className: styles.datetime
        }, item.datetime))
      }));
    }));
  }

  var title = /*#__PURE__*/React.createElement("div", {
    className: styles.content
  }, /*#__PURE__*/React.createElement("span", {
    className: styles['content-title']
  }, contentTitle), /*#__PURE__*/React.createElement("span", {
    className: styles['content-action']
  }, contentTitleAction));
  return /*#__PURE__*/React.createElement("div", null, title, content);
}